
Skt.PanTool = Skt.Tool.extend({

	enable: function(editor) {
		Skt.Tool.prototype.enable.call(this, editor);
		this.name = "pan";

		// Moving state
		this._moving = false;
	},

	onDragstartElement: function(element, event){},
	onDragmoveElement: function(element, event){},
	onDragendElement: function(element, event){},

	onDragstartCanvas: function(canvas, event) {
		this._moving = true;
		var node = canvas.getSVGNode()[0];

		this._inix = parseInt(node.style.left);
		this._iniy = parseInt(node.style.top);
		this._x = event.pageX;
		this._y = event.pageY;
		this._node = node;
	},

	onDragmoveCanvas: function(canvas, event) {
		if (this._moving == true) {
			var dx = (event.pageX - this._x);
			var dy = (event.pageY - this._y);
			canvas._panzoom.pan(dx, dy);
			this._x = event.pageX;
			this._y = event.pageY;
			Skt.Slide.updateEditorBackground();
		}
	},

	onDragendCanvas: function(canvas, event){
		this._moving = false;
	},

	disable: function(editor) {},

});
